﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:WickedFlame.Util.Controls">

    <LinearGradientBrush x:Key="BackgroundBrush" StartPoint="0,0" EndPoint="0,1">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#F7F7F7" Offset="0"/>
            <GradientStop Color="DarkGray" Offset="1"/>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>

    <Style TargetType="{x:Type Button}" x:Key="smallButtons">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border BorderBrush="#888888" BorderThickness="1" Background="Transparent" Padding="2" CornerRadius="2">
                        <ContentPresenter ContentSource="Content"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="{x:Type local:LayerButton}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:LayerButton}">
                    <Grid Name="LayerGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="40"/>
                            <ColumnDefinition />
                            <ColumnDefinition Width="20"/>
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>

                        <Border BorderBrush="Black" Name="viewborder" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.RowSpan="2">
                            <Grid>
                                <Viewbox x:Name="PART_Viewbox">
                                    <local:LayerImage x:Name="PART_LayerImage" Layer="{Binding .}" Background="WhiteSmoke"/>
                                </Viewbox>
                            </Grid>
                        </Border>

                        <Border Background="Transparent" BorderThickness="0" Grid.RowSpan="2" Grid.ColumnSpan="2" />

                        <Button x:Name="PART_ButtonVisible" Margin="1,1,1,1" Grid.Column="2" Grid.Row="0" Style="{StaticResource smallButtons}" >
                            <Grid>
                                <Image Name="imageInvisible" Source="/VecDraw.Resources;component/Images/VecDraw.Pin.EyeCancel.png" ToolTip="Invisible" Visibility="Collapsed"/>
                                <Image Name="imageVisible" Source="/VecDraw.Resources;component/Images/VecDraw.Pin.EyeOrange.png" ToolTip="Visible"/>
                            </Grid>
                        </Button>
                        <Button x:Name="PART_ButtonLock" Margin="1,0,1,2" Grid.Column="2" Grid.Row="1" Style="{StaticResource smallButtons}" ToolTip="Lock">
                            <Grid>
                                <Image Name="imageLocked" Source="/VecDraw.Resources;component/Images/VecDraw.Pin.Lock.png" ToolTip="Invisible" Visibility="Collapsed"/>
                                <Image Name="imageUnlocked" Source="/VecDraw.Resources;component/Images/VecDraw.Pin.Unlock.png"  />
                            </Grid>
                        </Button>
                        
                    </Grid>
                    
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsVisible" Value="false">
                            <Setter TargetName="imageVisible" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="imageInvisible" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsLocked" Value="true">
                            <Setter TargetName="imageLocked" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="imageUnlocked" Property="Visibility" Value="Collapsed"/>
                        </Trigger>

                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
                            <Setter Property="BorderThickness" Value="1"/>
                        </Trigger>
                        <!--<Trigger Property="IsSelected" Value="False">
                            <Setter Property="Background" Value="#FFD8D8D8"/>
                            <Setter Property="BorderThickness" Value="0"/>
                        </Trigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>